import { createWebHashHistory, createRouter, RouteRecordRaw } from 'vue-router'

import HomeView from '../view/HomeView.vue'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

const routes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        component: () =>
            import("../inception/LoginView.vue"),
        meta: {
            title: "智界峨眉",
            hidden: true,
            notNeedAuth: true
        }
    },
    {
        path: '/supervisory',
        name: 'supervisory',
        component: () => import('../view/Monitoring.vue'),
        meta: {
            title: '智慧大屏',
            hidden: true,
            noAuto: true,
        }
    },
    {
        path: '/',
        name: 'HOmeView',
        component: HomeView,
        // redirect: '/beidou',
        children: [
            // {
            //     path: '/supervisory',
            //     name: 'supervisory',
            //     component: ()=> import('../view/Monitoring.vue'),
            //     meta: {
            //         title: '实时监控', 
            //         noAuto: true,
            //     }
            // },
            {
                path: '/data',
                name: 'data',
                component: () => import('../view/DataStatistics.vue'),
                meta: {
                    title: '数据中心',
                    noAuto: true,
                }
            },
            {
                path: '/workbench',
                name: 'workbench',
                component: () => import('../view/Workbench.vue'),
                meta: {
                    title: '工作台',
                    noAuto: true,
                }
            },
            {
                path: '/vehicle',
                name: 'vehicle',
                component: () => import('../view/VehicleManage.vue'),
                meta: {
                    title: '车辆管理',
                    noAuto: true,
                },
            },
            {
                path: '/employee',
                name: 'employee',
                component: () => import('../view/EmployeeManage.vue'),
                meta: {
                    title: '员工管理',
                    noAuto: true,
                }
            },
            {
                path: '/journey',
                name: 'journey',
                component: () => import('../view/TripManage.vue'),
                meta: {
                    title: '行程管理',
                    noAuto: true,
                }
            },
            {
                path: '/repair',
                name: 'repair',
                component: () => import('../view/MaintenanceRecord.vue'),
                meta: {
                    title: '维修记录',
                    noAuto: true,
                }
            },
            {
                path: '/individual',
                name: 'individual',
                component: () => import('../view/IndividualCenter.vue'),
                meta: {
                    title: '个人中心',
                    noAuto: true,
                }
            },
            {
                path: '/setting',
                name: 'setting',
                component: () => import('../view/Setting.vue'),
                meta: {
                    title: '公告管理',
                    noAuto: true,
                }
            },
            {
                path: '/vehicle/add',
                name: 'vehicle_add',
                component: () => import('../components/VehicleManage/VehicleAdd.vue'),
                meta: {
                    title: '添加车辆',
                    noAuto: true
                }
            },
            {
                path: '/employee/add',
                name: 'employee_add',
                component: () => import('../components/EmployeeManage/EmployeeAdd.vue'),
                meta: {
                    title: '添加员工',
                    noAuto: true
                }
            },
            {
                path: '/records',
                name: 'records',
                component: () => import('../components/Work/Records.vue'),
                meta: {
                    title: '事故详情',
                    noAuto: true
                }
            }
        ]
    },
]

export const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

router.afterEach(() => {
    NProgress.done();
});

export default router